/<template>
  <div>
    <h1>数字{{ $store.state.num }}</h1>
    <h1>第二次数字{{num}}</h1>
    <button @click="changeNum">点击++</button>
  </div>
</template>

<script>
import {mapState,mapMutations} from 'vuex'
export default {
  mounted() {
    console.log(this.$store);
  },
  computed: {
    ...mapState(['num'])
  },
  methods: {
    ...mapMutations(['addNum']),
    changeNum() {
      // this.$store.commit('addNum', )
      this.addNum(2)
    },
  },
};
</script>

<style>
</style>